home *** CD-ROM | disk | FTP | other *** search
- Path: server-b.cs.interbusiness.it!usenet
- From: albe@piw.it (Alberto Velo)
- Newsgroups: comp.lang.c++
- Subject: Need Help!
- Date: Tue, 16 Apr 1996 21:41:23 -0100
- Organization: Centro Servizi Interbusiness
- Message-ID: <TICdxQTC3c9e090yn@piw.it>
- Reply-To: albe@piw.it
- NNTP-Posting-Host: pittys16.gvo.it
- X-PGP-Fingerprint: BE C9 BE 39 20 8C A4 F2 22 FE 02 56 C3 31 51 F9
- X-Newsreader: Yarn for OS/2 v0.90
-
- I have a problem I can't manage to solve.. perhaps you gurus might help me? :)
-
- I have a class:
-
- class Datiftp
- {
- public:
- char nome[MAXLEN], path[MAXLEN], sito[MAXLEN],
- dir[MAXLEN], file[MAXLEN], logf[MAXSIZE];
- Datiftp();
- Datiftp(Datiftp &);
- };
-
- and create an array of objects, with:
-
- Datiftp *ftp;
- ftp = new Datiftp [SESSIONS];
- if (!ftp) error(NOMEMORY);
-
- Then I play with the objects array, and at a certain point I have the function
- copiafile(). Parms are a file name and another filename (the function moves the
- file from current dir to another dir, for example file=pippo.zip and
- newfile=c:\dir\subdir\pippo.zip).
- Function is called from within another member function, with:
-
- copiafile(sesftp[n].file, tmp);
-
- Where sesftp[n] is another array of objects of class DatiFtp, created like ftp
- (see some lines up).
- This works, but only with the first object of the array (i.e. the first file I
- use as parm)! The second time I get an error when I open the ofstream (i.e.
- function exits with error(NOWRITEFILE).
-
- void Dat::copiafile(char *file, char *newfile) // copia file nella userdir
- {
- char c;
- ifstream in;
- in.open(file, ios::in | ios::binary);
- if (!in) error(NOREADFILE);
-
- ofstream out;
- out.open(newfile, ios::out | ios::binary);
- if (!out) error(NOWRITEFILE);
-
- while (!in.eof()) {
- in.get(c);
- if (!in.eof()) out.put(c);
- } /* endwhile */
-
- in.close();
- out.close();
-
- }
-
- I tried using C syntax (FILE* instead of streams) or using direct "ofstream
- out(newfile, ios::binary); ", but the result is still the same ;(
-
- If anybody can help please answer in **E-MAIL**, since I don't have the time to
- follow the newsgroup every day.
-
- --
- Bye, AL!
-
- Team OS/2 Italia WebMaster ---> MD1652@mclink.it
- IBM DAP Member
- E-mail : albe@piw.it
- Fidonet: 2:334/708.1
- PGP Key available OS2net : 81:439/63.1
- BBS : Telnet bbs.piw.it (194.21.239.4)
-
- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---
- - Craxi e' solo con se stesso
- - Quell'uomo continua a circondarsi delle persone sbagliate
-
- ElleKappa
- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---
-